define(['app'],function(app){return {module: function($scope, $http, eventBusService, httpService, params, configService) {
	$scope.goback = function(){
		var menu = {};
		menu.url = "modules/content/dataexchange/developer/set?father_id="+params.father_id+"&fk_app="+params.appid;
		eventBusService.publish("modules.content.load",menu);
	}
	//保存
	$scope.save = function(){
	  	$("#"+$scope.controllerName+" input[name='dataPk']").each(function(){ 
	  		var aapPk = $(".ParamPk"+$(this).val()).val();
	  		if($(this).prop("checked")){
	  			if(aapPk == '0'){
	  				var vo = {};
	          		vo.fk_api_param = $(this).val();
	          		vo.fk_app = params.appid;
	          		httpService.postpage(app.urls.app_insertAppApiParam, vo, function(data) {
	        		});
	  			}
	      	}else{
	      		if(aapPk != '0'){
	      			httpService.postpage(app.urls.app_deleteAppApiParam, {"aap_pk": aapPk}, function(data) {
	        			
	        		});	  			
	      		}
	      	}
	  	});
	  	init();
	  	$scope.find();
	  	$scope.goback();
  	}
	
	
	$scope.select = function(){
		$scope.find();
	}
	
	$scope.find = function(){
		$scope.form.fk_api = params.apiid;
		$scope.form.fk_app = params.appid;
		httpService.postpage(app.urls.api_selectApiParam, $scope.form, function(data) {
			if ("0000" === data.code) {
				$scope.dataList = data.data;
			} else {
				alert(data.msg);
			}
		});
	}

	
	var init = function(){
		httpService.post(app.urls.dictionary_selectOne, $scope.form, function(data) {
			if ("0000" === data.code) {
				$scope.dicList = data.data;
				$scope.$apply();
			} else {
				alert(data.msg);
			}
		});
		$scope.form.api_pk = params.apiid;
		httpService.post(app.urls.api_select, $scope.form, function(data) {
			if ("0000" === data.code) {
				$scope.apiInfo = data.data[0];
				$scope.$apply();
			} else {
				alert(data.msg);
			}
		});
		
	}
	init();
	$scope.find();
}}});